//
//  PpOutDoorViewController.swift
//  Palmpilot
//
//  Created by 杨伟毅 on 2018/10/30.
//  Copyright © 2018年 杨伟毅. All rights reserved.
//

import UIKit

class PpOutDoorViewController: PpBaseViewController,UITableViewDelegate,UITableViewDataSource {
    let baseView = UITableView.init(frame: ZCGRECT(x: 0, y: 0, width: SCREEN_width, height: SCREEN_HEIGHT-TopHeight))
     let titleArr =  [PpLanguageSwitchTool.getString(key: "OCR"),PpLanguageSwitchTool.getString(key: "Looking for processing"),PpLanguageSwitchTool.getString(key: "Matters needing attention")]
    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        self.title = PpLanguageSwitchTool.getString(key: "Outdoor knowledge")
    }
    override func viewDidLoad() {
        super.viewDidLoad()
        baseView.delegate = self
        baseView.dataSource = self
        baseView.tableFooterView = UIView()
        baseView.estimatedRowHeight = 100
        baseView.separatorStyle = .none
        baseView.register(UINib.init(nibName: "PpMainTableViewCell", bundle: Bundle.main), forCellReuseIdentifier: "PpMainTableViewCell")
        PpBaseTool.insetTableViewAndUIViewController(baseView: baseView, baseVC: self)
        self.view.addSubview(baseView)
        // Do any additional setup after loading the view.
    }
    func numberOfSections(in tableView: UITableView) -> Int {
        return 1
    }
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return titleArr.count
    }
    func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
        return 100
    }
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let basecell:PpMainTableViewCell? = tableView.dequeueReusableCell(withIdentifier: "PpMainTableViewCell") as? PpMainTableViewCell
        basecell?.baseLabel.text = titleArr[indexPath.row]
        basecell?.selectionStyle = .none
        return basecell!
    }
    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        switch (indexPath.row){
        case 0:
            self.navigationController?.pushViewController(PpBasicEquipmentVC(), animated: true)
            break
        case 1:
            self.navigationController?.pushViewController(PpLookingForViewController(), animated: true)
            break
        case 2:
            self.navigationController?.pushViewController(PpAttentionViewController(), animated: true)
            break
        default:
            break
        }
    }
    

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
